package Client;
import java.rmi.Naming;

import Server.Service;
import Server.ServicesServer;

public class Client {
	ServicesServer serveur;

	public Object[] getListeServices() {

		Object obj = null;
		Object[] services = null;
		
		try {
			
			//obj = Naming.lookup("rmi://127.0.0.1/ServeurServices");
			obj = Naming.lookup("ServeurServices");
			
		}
		catch(Exception ex) {
			ex.printStackTrace();
		}
		
		
		serveur = (ServicesServer) obj;


		try {

			services = serveur.getListeServices();

		} catch(Exception ex) {
			ex.printStackTrace();
		}
		return services;

	}
	
//	public JPanel chargerService(Object serviceChoisi) {
//		try {
//			Service svc = serveur.getService(serviceChoisi);
//
//			return svc.getIHM();
//		} catch(Exception ex) {
//			ex.printStackTrace();
//		}
//		return null;
//	}
	
	public void chargerService(Object serviceChoisi) {
		try {
			Service svc = serveur.getService(serviceChoisi);

			svc.go();
		} catch(Exception ex) {
			ex.printStackTrace();
		}
	}
}